/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import slcu.model.Disciplina;
import slcu.model.DisciplinaModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the Disciplina service. Represents a row in the &quot;SLCU_Disciplinas&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link slcu.model.DisciplinaModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DisciplinaImpl}.
 * </p>
 *
 * @author tito
 * @see DisciplinaImpl
 * @see slcu.model.Disciplina
 * @see slcu.model.DisciplinaModel
 * @generated
 */
public class DisciplinaModelImpl extends BaseModelImpl<Disciplina>
	implements DisciplinaModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a Disciplina model instance should use the {@link slcu.model.Disciplina} interface instead.
	 */
	public static final String TABLE_NAME = "SLCU_Disciplinas";
	public static final Object[][] TABLE_COLUMNS = {
			{ "disciplinaId", Types.BIGINT },
			{ "nombre", Types.VARCHAR },
			{ "minimoPorEquipo", Types.BIGINT },
			{ "maximoPorEquipo", Types.BIGINT },
			{ "requiereHabilitacion", Types.BOOLEAN },
			{ "tipoEvento", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table SLCU_Disciplinas (disciplinaId LONG not null primary key,nombre VARCHAR(75) null,minimoPorEquipo LONG,maximoPorEquipo LONG,requiereHabilitacion BOOLEAN,tipoEvento VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table SLCU_Disciplinas";
	public static final String ORDER_BY_JPQL = " ORDER BY disciplina.nombre ASC";
	public static final String ORDER_BY_SQL = " ORDER BY SLCU_Disciplinas.nombre ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.slcu.model.Disciplina"), true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.slcu.model.Disciplina"), true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.slcu.model.Disciplina"));

	public DisciplinaModelImpl() {
	}

	public long getPrimaryKey() {
		return _disciplinaId;
	}

	public void setPrimaryKey(long primaryKey) {
		setDisciplinaId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_disciplinaId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return Disciplina.class;
	}

	public String getModelClassName() {
		return Disciplina.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("disciplinaId", getDisciplinaId());
		attributes.put("nombre", getNombre());
		attributes.put("minimoPorEquipo", getMinimoPorEquipo());
		attributes.put("maximoPorEquipo", getMaximoPorEquipo());
		attributes.put("requiereHabilitacion", getRequiereHabilitacion());
		attributes.put("tipoEvento", getTipoEvento());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long disciplinaId = (Long)attributes.get("disciplinaId");

		if (disciplinaId != null) {
			setDisciplinaId(disciplinaId);
		}

		String nombre = (String)attributes.get("nombre");

		if (nombre != null) {
			setNombre(nombre);
		}

		Long minimoPorEquipo = (Long)attributes.get("minimoPorEquipo");

		if (minimoPorEquipo != null) {
			setMinimoPorEquipo(minimoPorEquipo);
		}

		Long maximoPorEquipo = (Long)attributes.get("maximoPorEquipo");

		if (maximoPorEquipo != null) {
			setMaximoPorEquipo(maximoPorEquipo);
		}

		Boolean requiereHabilitacion = (Boolean)attributes.get(
				"requiereHabilitacion");

		if (requiereHabilitacion != null) {
			setRequiereHabilitacion(requiereHabilitacion);
		}

		String tipoEvento = (String)attributes.get("tipoEvento");

		if (tipoEvento != null) {
			setTipoEvento(tipoEvento);
		}
	}

	public long getDisciplinaId() {
		return _disciplinaId;
	}

	public void setDisciplinaId(long disciplinaId) {
		_disciplinaId = disciplinaId;
	}

	public String getNombre() {
		if (_nombre == null) {
			return StringPool.BLANK;
		}
		else {
			return _nombre;
		}
	}

	public void setNombre(String nombre) {
		_nombre = nombre;
	}

	public long getMinimoPorEquipo() {
		return _minimoPorEquipo;
	}

	public void setMinimoPorEquipo(long minimoPorEquipo) {
		_minimoPorEquipo = minimoPorEquipo;
	}

	public long getMaximoPorEquipo() {
		return _maximoPorEquipo;
	}

	public void setMaximoPorEquipo(long maximoPorEquipo) {
		_maximoPorEquipo = maximoPorEquipo;
	}

	public boolean getRequiereHabilitacion() {
		return _requiereHabilitacion;
	}

	public boolean isRequiereHabilitacion() {
		return _requiereHabilitacion;
	}

	public void setRequiereHabilitacion(boolean requiereHabilitacion) {
		_requiereHabilitacion = requiereHabilitacion;
	}

	public String getTipoEvento() {
		if (_tipoEvento == null) {
			return StringPool.BLANK;
		}
		else {
			return _tipoEvento;
		}
	}

	public void setTipoEvento(String tipoEvento) {
		_tipoEvento = tipoEvento;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			Disciplina.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public Disciplina toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (Disciplina)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public Object clone() {
		DisciplinaImpl disciplinaImpl = new DisciplinaImpl();

		disciplinaImpl.setDisciplinaId(getDisciplinaId());
		disciplinaImpl.setNombre(getNombre());
		disciplinaImpl.setMinimoPorEquipo(getMinimoPorEquipo());
		disciplinaImpl.setMaximoPorEquipo(getMaximoPorEquipo());
		disciplinaImpl.setRequiereHabilitacion(getRequiereHabilitacion());
		disciplinaImpl.setTipoEvento(getTipoEvento());

		disciplinaImpl.resetOriginalValues();

		return disciplinaImpl;
	}

	public int compareTo(Disciplina disciplina) {
		int value = 0;

		value = getNombre().compareTo(disciplina.getNombre());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Disciplina disciplina = null;

		try {
			disciplina = (Disciplina)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = disciplina.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<Disciplina> toCacheModel() {
		DisciplinaCacheModel disciplinaCacheModel = new DisciplinaCacheModel();

		disciplinaCacheModel.disciplinaId = getDisciplinaId();

		disciplinaCacheModel.nombre = getNombre();

		String nombre = disciplinaCacheModel.nombre;

		if ((nombre != null) && (nombre.length() == 0)) {
			disciplinaCacheModel.nombre = null;
		}

		disciplinaCacheModel.minimoPorEquipo = getMinimoPorEquipo();

		disciplinaCacheModel.maximoPorEquipo = getMaximoPorEquipo();

		disciplinaCacheModel.requiereHabilitacion = getRequiereHabilitacion();

		disciplinaCacheModel.tipoEvento = getTipoEvento();

		String tipoEvento = disciplinaCacheModel.tipoEvento;

		if ((tipoEvento != null) && (tipoEvento.length() == 0)) {
			disciplinaCacheModel.tipoEvento = null;
		}

		return disciplinaCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{disciplinaId=");
		sb.append(getDisciplinaId());
		sb.append(", nombre=");
		sb.append(getNombre());
		sb.append(", minimoPorEquipo=");
		sb.append(getMinimoPorEquipo());
		sb.append(", maximoPorEquipo=");
		sb.append(getMaximoPorEquipo());
		sb.append(", requiereHabilitacion=");
		sb.append(getRequiereHabilitacion());
		sb.append(", tipoEvento=");
		sb.append(getTipoEvento());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(22);

		sb.append("<model><model-name>");
		sb.append("slcu.model.Disciplina");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>disciplinaId</column-name><column-value><![CDATA[");
		sb.append(getDisciplinaId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>nombre</column-name><column-value><![CDATA[");
		sb.append(getNombre());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>minimoPorEquipo</column-name><column-value><![CDATA[");
		sb.append(getMinimoPorEquipo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>maximoPorEquipo</column-name><column-value><![CDATA[");
		sb.append(getMaximoPorEquipo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>requiereHabilitacion</column-name><column-value><![CDATA[");
		sb.append(getRequiereHabilitacion());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>tipoEvento</column-name><column-value><![CDATA[");
		sb.append(getTipoEvento());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = Disciplina.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			Disciplina.class
		};
	private long _disciplinaId;
	private String _nombre;
	private long _minimoPorEquipo;
	private long _maximoPorEquipo;
	private boolean _requiereHabilitacion;
	private String _tipoEvento;
	private Disciplina _escapedModelProxy;
}